from typing import List, Optional
import ormar
from pydantic.networks import EmailStr

from app.core.db import metadata, database


class BaseMeta(ormar.ModelMeta):
    database = database
    metadata = metadata


class Customer(ormar.Model):
    class Meta(BaseMeta):
        tablename = 'customers'


    id: int = ormar.Integer(primary_key=True)
    # expertises: List[Expertise] = ormar.ForeignKey(Expertise)
    legal_entity: bool = ormar.Boolean()
    first_name: str = ormar.String(max_length=32)
    last_name: str = ormar.String(max_length=32)
    patronymic: str = ormar.String(max_length=32)
    address: str = ormar.String(max_length=128)
    phone_number: str = ormar.String(max_length=20)
    email: Optional[EmailStr] = ormar.String(max_length=256)

